package router

import (
	"server/middleware"
	"server/plugin/amall/api"
	"github.com/gin-gonic/gin"
)

type CommentRouter struct{}

// InitCommentRouter 初始化 用户评论 路由信息
func (s *CommentRouter) InitCommentRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
	commentRouter := Router.Group("comment").Use(middleware.OperationRecord())
	//commentRouterWithoutRecord := Router.Group("comment")
	commentRouterWithoutAuth := PublicRouter.Group("comment")
	{
		commentRouter.POST("createComment", api.Api.CreateComment)             // 新建用户评论
		commentRouter.DELETE("deleteComment", api.Api.DeleteComment)           // 删除用户评论
		commentRouter.DELETE("deleteCommentByIds", api.Api.DeleteCommentByIds) // 批量删除用户评论
		commentRouter.PUT("updateComment", api.Api.UpdateComment)              // 更新用户评论
	}
	{
		commentRouterWithoutAuth.GET("findComment", api.Api.FindComment)       // 根据ID获取用户评论
		commentRouterWithoutAuth.GET("getComment", api.Api.GetComment)         // 根据ID获取用户评论
		commentRouterWithoutAuth.GET("getCommentList", api.Api.GetCommentList) // 获取用户评论列表
	}
	{
		commentRouterWithoutAuth.GET("getCommentPublic", api.Api.GetCommentPublic) // 获取用户评论列表
	}
}
